<?php

namespace app\admin\model;

use think\Db;
use think\Model;
use think\cache\driver\Redis;

class RedisData extends Model
{

    // 获取redis 中的数据
    public function getRedisData($keyName){
        $this->redis = new Redis();
        if($this->redis->get($keyName)){
            return $this->redis->get($keyName);
        }else{
            return '';
        }
    }


    // 设置redis 数据
    public function setRedisData($keyName,$value){
        $this->redis = new Redis();
        if($this->redis->set($keyName,$value)){
            return true;
        }else{
            return false;
        }
    }
}
